import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import MyView from '../views/my/MyView.vue'
import IndexView from '../views/index/IndexView.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/sy'  // 重定向
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: 'indexV',
        name: 'indexV',
        redirect: { name: 'index' },
        component: IndexView,
        children: [
          {
            path: 'index',
            name: 'index',
            component: () => import('../views/index/Index.vue'),
          },
          {
            path: 'activity',
            name: 'activity',
            component: () => import('../views/index/Activity.vue'),
          },
        ]
      },
      {
        path: 'find',
        name: 'find',
        component: () => import('../views/find/Discover.vue'),
      },
      {
        path: 'plan',
        name: 'plan',
        component: () => import('../views/plan/Plan.vue'),
      },
      {
        path: 'team',
        name: 'team',
        component: () => import('../views/team/Team.vue'),
      },
      {
        path: 'my',
        name: 'my',
        redirect: { name: 'userc' },
        component: MyView,
        children: [
          {
            path: 'userc',
            name: 'userc',
            component: () => import('../views/my/UserC.vue')
          },
        ]
      },

    ]
  },
  {
    path: '/index',
    name: 'index',
    component: IndexView,
    children: [
      {
        path: 'detail/:id',
        name: 'detail',
        component: () => import('../views/index/DetailView.vue'),
      },
      {
        path: 'allcourse',
        name: 'allcourse',
        component: () => import('../views/index/AllCourse.vue'),
      },
    ]
  },

  {
    path: '/index/course/more/:id',
    name: 'more',
    component: () => import('../views/index/moreView.vue'),
  },
  {
    path: '/index/moretype',
    name: 'run',
    component: () => import('../views/fun/all.vue')
  },
  {
    path: '/index/walk',
    name: 'run',
    component: () => import('../views/fun/walk.vue')
  },

  
  {
    path: '/find/dynamic/:id',
    name: 'dynamic',
    component: () => import('../views/find/Dynamic.vue')
  },

  {
    path: '/team/biography/:id',
    name: 'dynamic',
    component: () => import('../views/team/Biography.vue')
  },


  {
    path: '/my',
    name: 'my',
    component: MyView,
    children: [
      {
        path: 'userk',
        name: 'userk',
        component: () => import('../views/my/UserK.vue')
      },
      {
        path: 'setup',
        name: 'setup',
        component: () => import('../views/my/Setup.vue')
      },
      {
        path: 'pwd',
        name: 'pwd',
        component: () => import('../views/my/Pwd.vue')
      },
      {
        path: 'photo',
        name: 'photo',
        component: () => import('../views/my/Photo.vue')
      },
      {
        path: 'course',
        name: 'course',
        component: () => import('../views/my/Course.vue')
      }, {
        path: 'about',
        name: 'about',
        component: () => import('../views/AboutView.vue')
      },
    ]

  },



  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/Login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/register/Register.vue')
  },
  {
    path: '/sy',
    name: 'sy',
    component: () => import('../views/login/Sy.vue')
  },
  {
    path: '/name/:id',
    name: 'name',
    component: () => import('../views/register/name.vue')
  },
  {
    path: '/tz/:id',
    name: 'tz',
    component: () => import('../views/register/tz.vue')
  },



  {
    path: '/activity/activitydetail/:id',
    name: 'activity',
    component: () => import('../views/activity/Club.vue'),
  },
  {
    path: '/activity/new/:id',
    component: () => import('../views/activity/New.vue'),
  }, {
    path: '/activity/hot',
    component: () => import('../views/activity/Hot.vue'),
  }, {
    path: '/activity/selected',
    component: () => import('../views/activity/Selected.vue'),
  }, {
    path: '/activity/run',
    component: () => import('../views/activity/Run.vue'),
  }, {
    path: '/activity/brand',
    component: () => import('../views/activity/Brand.vue'),
  }, {
    path: '/activity/position/:id',
    component: () => import('../views/activity/Position.vue'),
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search/Search.vue'),
  },

  {
    path: '/search_course',
    name: 'search_course',
    component: () => import('../views/search/SearchCourse.vue'),
  },




  {
    path: '/test',
    name: 'test',
    component: () => import('../views/test.vue')
  },
  {
    path: '/team',
    name: 'team',
    component: () => import('../views/team/Team.vue')
  },
  {
    path: '/find/biography',
    name: 'biography',
    component: () => import('../views/team/Biography.vue')
  }
]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
